<?php

namespace ua_backend\models\search;

use api\modules\ua\models\Uuid;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use ua_backend\models\Shops;

/**
 * RadoLocationsSearch represents the model behind the search form of `backend\models\RadoLocations`.
 */
class UuidSearch extends Uuid
{
    public function rules()
    {
        return [
            [['id'], 'integer'],
            [['uuid'], 'safe'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Uuid::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pagesize' => Yii::$app->params['pageSize'],
            ],
        ]);

        $this->load($params);

        if (!$this->validate()) {
            return $dataProvider;
        }

        return $dataProvider;
    }
}
